<?php
namespace app\organization\controller\say;

use app\common\controller\Frontend;
use app\common\enums\say\SayCategoryStatusEnum;
use app\common\model\banxi\say\SayCategory as SayCategoryModel;
use think\db\exception\DbException;

class Category extends Frontend
{
    protected array $noNeedLogin = [];
    protected array $noNeedPermission = ["*"];

    public function initialize(): void
    {
        parent::initialize();
        $this->model = new SayCategoryModel();
    }


    /**
     * 分页Select查询
     * @return void
     * @throws DbException
     */
    public function listSelectPage(): void
    {
        $param = $this->request->param(['index', 'limit', 'orderBy', "query", 'searchText']);
        if (!empty($param['searchText'])) {
            $param['query']['LIKE_name'] = $param['searchText'];
        }
        $param['query']['EQ_status'] = SayCategoryStatusEnum::E1;
        //查询条件解析
        $where = get_query($param);
        //获取分页数据
        $pageParams = get_page_params($param);
        $list = $this->model->getListSelectPage($where, $pageParams['page'], $pageParams['limit']);
        $this->ok('操作成功', result_row($list));
    }
}
